package four;

public class girlFriendTest {

    public static void main(String[] args) {
        girlFriend[] arr = new girlFriend[4];

        girlFriend gf1 = new girlFriend("小诗诗",18,"女","打游戏");
        girlFriend gf2 = new girlFriend("小惠惠",20,"女","睡觉");
        girlFriend gf3 = new girlFriend("小莉莉",19,"女","吃零食");
        girlFriend gf4 = new girlFriend("小丹丹",22,"女","看电影");


        arr[0]= gf1;
        arr[1]= gf2;
        arr[2]= gf3;
        arr[3]= gf4;

        int sum = 0;
        for (int i = 0; i <arr.length;i++) {
            girlFriend gf = arr[i];
            sum = sum +gf.getAge();
            
        }
        int avg = sum/ arr.length;
        int count = 0;
        for (int i = 0; i <arr.length;i++) {
            girlFriend gf = arr[i];
            if (gf.getAge()<avg){
                System.out.println(gf.getName()+","+gf.getAge()+","+gf.getGender()+","+gf.getHobby());
                count++;
                System.out.println(count);
            }

        }


    }
}
